﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BusinessObjects.BO_GetObjects;
using System.Data;
using BusinessObjects.BO_GetObjects;
using DigiLib;
using System.Data;
public partial class Controls_NewsEvents : Base_Controls {
    protected void Page_Load(object sender, EventArgs e) {
        base.setField(Convert.ToInt32(this.Attributes["ID"]));
        if(!IsPostBack) {
            LoadData();
        }
    }
    //load data

    public void LoadData() {
        ObjDT = BO_portal_categories.Search(Cid);
        if(ObjDT.Rows.Count > 0) {
            if(base.Lang)
                h2Title.InnerText = ObjDT.Rows[0]["FULL_CATEGORY_NAME_ENG"].ToString();
            else
                h2Title.InnerText = ObjDT.Rows[0]["FULL_CATEGORY_NAME"].ToString();
        } else
            h2Title.InnerText = MName;
        int lang = 0;
        if(base.Lang) {
            lang = 1;
            mLink.InnerText = "Read more";
            DetailLink.InnerText = "Read more";
        }
        ObjDT = BO_portal_articles.SelectLangByModule(Mid, base.PSize, lang);
        if(ObjDT.Rows.Count > 0) {
            pictureLink.HRef = "/tin-tuc/" + DigiLib.StringUtils.RemoveUnicode(ObjDT.Rows[0]["FULL_ARTICLE_TITLE"].ToString(), "-") + "-c" + ObjDT.Rows[0]["CATEGORY_ID"].ToString() + "a" + ObjDT.Rows[0]["ARTICLE_ID"].ToString() + ".htm";
            TitleLink.HRef = "/tin-tuc/" + DigiLib.StringUtils.RemoveUnicode(ObjDT.Rows[0]["FULL_ARTICLE_TITLE"].ToString(), "-") + "-c" + ObjDT.Rows[0]["CATEGORY_ID"].ToString() + "a" + ObjDT.Rows[0]["ARTICLE_ID"].ToString() + ".htm";
            DetailLink.HRef = "/tin-tuc/" + DigiLib.StringUtils.RemoveUnicode(ObjDT.Rows[0]["FULL_ARTICLE_TITLE"].ToString(), "-") + "-c" + ObjDT.Rows[0]["CATEGORY_ID"].ToString() + "a" + ObjDT.Rows[0]["ARTICLE_ID"].ToString() + ".htm";
            TitleLink.InnerText = ObjDT.Rows[0]["FULL_ARTICLE_TITLE"].ToString();
            PictureImage.Src = "/upload/" + ObjDT.Rows[0]["THUMB_IMG"].ToString();
            ObjDT.Rows.RemoveAt(0);
        }
        bindRepeater(rptkm, ObjDT);
    }
}